<#import "spring.ftl" as spring />
<html>
<head>
	<title>Schedule your inspection</title>
</head>
<body>

<#include "schedulebreadcrumb.ftl">

<div id="content">

	<div id="infoBox">
	<table>
	<tr>
		<td><b>Home Inspector:</b></td>
		<td>${inspection.inspector.name} of ${inspection.inspector.company.name}</td>
	</tr>
	<tr>
		<td><b>Property Address:</b></td>
		<td>${inspection.property.location.street1}, ${inspection.property.location.city}</td>
	</tr>
	<tr>
		<td><b>Time of Inspection:</b></td>
		<td>${inspection.inspectionTime?date} at ${inspection.inspectionTime?time?string.short}</td>
	</tr>
	<tr>	
		<#if RequestParameters.feeChange??>
			<#assign redStyle="color: red" />
		</#if>
		<td><span style="${redStyle!}"><b>Inspection Fee:</b></span></td>
		<td><span style="${redStyle!}">$${inspection.inspectionFee}
		<#if RequestParameters.feeChange??>
			<-- CALCULATED NEW FEE
		</#if> 
		</span></td>

	</tr>
	</table>	
	</div>
	
	<#if RequestParameters.message??>
		<br/>
		<span class="errors">${RequestParameters.message!}</span>
	</#if>
	
	<h2>Reservation Confirmed</h2>

	<p>Your reservation is complete.  ${inspection.inspector.name} will visit your property on ${inspection.inspectionTime?date} at ${inspection.inspectionTime?time?string.short}.  There is no need for any further action on your part.</p>
	
	<p>However, should you want to reschedule or ask any additional questions about your inspection, please contact your inspector directly via e-mail (${inspection.inspector.email}) or phone (${inspection.inspector.phone}).
	<#if inspection.inspectionStatus != "CANCELLED">
		If you made a mistake or have changed your mind, you may <a href="cancel.html?inspectionId=${inspection.id}">cancel your inspection now</a>.
	</#if>
	</p>
	
	<hr/>
	
	<h2>PAYMENT</h2>
	<#if (authorizeNetPaymentRequest?? || paypalPaymentRequest??)>	  
		<p>If you want, you can pay for this inspection today.  Otherwise your inspector will make payment arrangements with you separately.</p>
		<table>
		<#if authorizeNetPaymentRequest??>
		<tr>
			<td>
				<form action="${authorizeNetPaymentRequest.paymentGatewayUrl}" method="post">
					<INPUT type='hidden' name='x_login' value='${authorizeNetPaymentRequest.loginId}' />
					<INPUT type='hidden' name='x_amount' value='${authorizeNetPaymentRequest.amount}' />
					<INPUT type='hidden' name='x_description' value='${authorizeNetPaymentRequest.description}' />
					<INPUT type='hidden' name='x_invoice_num' value='${authorizeNetPaymentRequest.invoiceNumber}' />
					<INPUT type='hidden' name='x_fp_sequence' value='${authorizeNetPaymentRequest.sequenceNumber?c}' />
					<INPUT type='hidden' name='x_fp_timestamp' value='${authorizeNetPaymentRequest.timestamp?c}' />
					<INPUT type='hidden' name='x_fp_hash' value='${authorizeNetPaymentRequest.fingerprint}' />
					<INPUT type='hidden' name='x_test_request' value='${authorizeNetPaymentRequest.testMode?string}' />
					<INPUT type='hidden' name='x_show_form' value='PAYMENT_FORM' />
					
					<INPUT type='hidden' name='x_first_name' value='${inspection.homeBuyer.name.first}' />
					<INPUT type='hidden' name='x_last_name' value='${inspection.homeBuyer.name.last}' />
					<INPUT type='hidden' name='x_address' value='${inspection.homeBuyer.address.street1}' />
					<INPUT type='hidden' name='x_city' value='${inspection.homeBuyer.address.city}' />
					<INPUT type='hidden' name='x_state' value='${(inspection.homeBuyer.address.state.longName)!}' />
					<INPUT type='hidden' name='x_zip' value='${inspection.homeBuyer.address.zipCode}' />
					<INPUT type='hidden' name='x_country' value='US' />
					<INPUT type='hidden' name='x_phone' value='${inspection.homeBuyer.phone}' />
					<INPUT type='hidden' name='x_fax' value='${inspection.homeBuyer.fax}' />
					<INPUT type='hidden' name='x_email' value='${inspection.homeBuyer.email}' />
					
					<INPUT type='hidden' name='x_ship_to_first_name' value='${inspection.homeBuyer.name.first}' />
					<INPUT type='hidden' name='x_ship_to_last_name' value='${inspection.homeBuyer.name.last}' />
					<INPUT type='hidden' name='x_ship_to_address' value='${inspection.homeBuyer.address.street1}' />
					<INPUT type='hidden' name='x_ship_to_city' value='${inspection.homeBuyer.address.city}' />
					<INPUT type='hidden' name='x_ship_to_state' value='${(inspection.homeBuyer.address.state.longName)!}' />
					<INPUT type='hidden' name='x_ship_to_zip' value='${inspection.homeBuyer.address.zipCode}' />
					<INPUT type='hidden' name='x_ship_to_country' value='US' />
					
					<input type='submit' value='PAY WITH CREDIT CARD' class="formButton" />
				</form>
			</td>
			<td>&nbsp;</td>
			<td align="center">
				<!-- (c) 2005, 2009. Authorize.Net is a registered trademark of CyberSource Corporation --> 
				<div class="AuthorizeNetSeal"> 
					<script type="text/javascript" language="javascript">
						var ANS_customer_id="1f6186ad-b337-43fb-9dca-bd56055b25e5";
					</script> 
					<script type="text/javascript" language="javascript" src="//verify.authorize.net/anetseal/seal.js" >
					</script> 
					<a href="http://www.authorize.net/" id="AuthorizeNetText" target="_blank">Online Payments</a> 
				</div>
			</td>
		</tr>
		</#if>
		<#if paypalPaymentRequest??>
		<tr>
			<td>
				<#-- see https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables -->
				<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
					<input type="hidden" name="cmd" value="_xclick">
					<input type="hidden" name="business" value="${paypalPaymentRequest.paymentEmail}">
					<input type="hidden" name="lc" value="US">
					<input type="hidden" name="notify_url" value="${paypalPaymentRequest.notifyUrl}">
					<input type="hidden" name="amount" value="${paypalPaymentRequest.amount}">
					<input type="hidden" name="item_name" value="${paypalPaymentRequest.description}">
					<input type="hidden" name="item_number" value="${paypalPaymentRequest.invoiceNumber}">
					<input type="hidden" name="button_subtype" value="services">
					<input type="hidden" name="currency_code" value="USD">
					<input type="hidden" name="page_style" value="primary">
					<input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynow_LG.gif:NonHostedGuest">
					<input type="submit" value="PAY WITH PAYPAL" class="formButton" />
					<#--
					<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_paynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
					<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
					-->
				</form>
			</td>
			<td></td>
			<td align="center">
				<!-- PayPal Logo --><table border="0" cellpadding="10" cellspacing="0" align="center"><tr><td align="center"></td></tr>
				<tr><td align="center"><a href="#" onclick="javascript:window.open('https://www.paypal.com/us/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');"><img  src="https://www.paypal.com/en_US/i/bnr/bnr_paymentsBy_150x60.gif" border="0" alt="Additional Options"></a></td></tr></table><!-- PayPal Logo -->
			</td>
		</tr>
		</#if>
		</table>		
	<#else>
		<p>Your inspector will make payment arrangements with you before or at the time of inspection.</p>
	</#if>

	<hr/>

	<h2>THANK YOU FOR YOUR BUSINESS!</h2>
	<p>We suggest you print this page for your records.  Otherwise you may now close this browser window.</p> 
		
</div>
</body>
</html>
